In [1]:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
from IPython.display import display, Math, Latex
import pylab
import plot_methods
import optimization_methods
%matplotlib inline
In [2]:
my_function = lambda x, y: x**2+2*y**2+0.012*x*y-2*y+x

Plot function graphic

In [3]:
plot_methods.plot_function(my_function, 'My function')

Newton method

In [4]:
results = optimization_methods.newton_method(my_function, [1,1], 1e-5)
number of iteration: 2, current point: [-0.50300905  0.50150903], function value: -0.7530135542439764
Precision: 1.2616401752273827e-06

Contour

In [5]:
plot_methods.plot_contour(my_function, 'Contour')

Contour and Scatter

In [6]:
plot_methods.plot_contour_and_scatter_of_descent(my_function, results, 
                                                 'Contour and Scatter Newton method')
In [ ]:
 
In [ ]: